import json
from os import makedirs
from os.path import exists, dirname

RESULTS_DIR = dirname(__file__) + '/output_file'
# print(RESULTS_DIR)
exists(RESULTS_DIR) or makedirs(RESULTS_DIR)

def save_data(data):
    name = data.get('name')
    data_path = f'{RESULTS_DIR}/{name}.json'
    json.dump(data, open(data_path, 'w', encoding='utf-8'), ensure_ascii=False, indent=2)
